package cz.tomasdvorak.cars.auth;

import org.apache.wicket.Session;
import org.apache.wicket.authorization.strategies.role.IRoleCheckingStrategy;
import org.apache.wicket.authorization.strategies.role.Roles;

import java.io.Serializable;

public class Auth implements IRoleCheckingStrategy, Serializable {

    public static final String ADMIN = "ADMIN";
    public static final String USER = "USER";

    public boolean hasAnyRole(Roles roles) {
        MyAuthenticatedWebSession authSession = (MyAuthenticatedWebSession) Session.get();
        return authSession.getRoles() != null && authSession.getRoles().hasAnyRole(roles);
    }
}
